import 'package:equatable/equatable.dart';

import 'Enums.dart';
import 'ImPojo.dart';

class ImUserAndGroup extends Equatable{
  int id;
  String code;
  String name;
  String firstLetter;
  UserAndGroupType type;
  // int? sessionId;

  ImUser? user;
  ImGroup? group;

  ImUserAndGroup({required this.id, required this.code, required this.name, required this.firstLetter,
    required this.type});

  @override
  List<Object?> get props => [id, type];
}

final class SearchResult extends Equatable {
  String? userId;          // 用户ID
  String? userName;
  String? headImg;
  ImUser? user;
  String? groupCode;
  String? groupName;
  ImGroup? group;
  int? messageTotal;
  int? sessionId;
  ImSession? session;

  @override
  List<Object?> get props => [userId, groupCode, messageTotal, sessionId];
}

final class SearchResultSet {
  List<SearchResult>? userSearchResults;
  List<SearchResult>? groupSearchResults;
  List<SearchResult>? messageSearchResults;

  SearchResultSet({ this.userSearchResults, this.groupSearchResults, this.messageSearchResults });

  int totalSize() {
    return (userSearchResults?.length??0) + (groupSearchResults?.length??0) + (messageSearchResults?.length??0);
  }
}

final class SearchResultGroup {
  int total;
  List<SearchResult> searchResultList;

  SearchResultGroup(this.total, this.searchResultList);
}

final class SlideLockData {
  String userId;
  String password;

  SlideLockData({required this.userId, required this.password});
}